﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Common;
using Common.Views;

namespace BL_WServices
{
    /// <summary>
    /// This is the Implementation of UsersService which is bound by a ServiceContract
    /// </summary>
    [ServiceContract]
    public interface IUsersService
    {
        /// <summary>
        /// Method to Authenticate that the user details are correct in order to allow the user to login
        /// </summary>
        /// <param name="username">Of type string: Username of the user</param>
        /// <param name="token">Of type string: Password of the user</param>
        /// <param name="pin">Of type int: Pin of the user</param>
        [OperationContract]
        bool AuthenticateUser(string username, string token, int pin);

        /// <summary>
        /// Method used to add a user to the database
        /// </summary>
        /// <param name="username">Of type string: Username of the user</param>
        /// <param name="password">Of type string: Password of the user</param>
        /// <param name="name">Of type string: Name of the user</param>
        /// <param name="surname">Of type string: Surname of the user</param>
        /// <param name="email">Of type string: Email of the user</param>
        /// <param name="mobileNo">Of type string: MobileNo of the user</param>
        /// <param name="residence">Of type string: Residence of the user</param>
        /// <param name="street">Of type string: Street of the user</param>
        /// <param name="town">Of type string: Town of the user</param>
        /// <param name="country">Of type string: Country of the user</param>
        /// <param name="pinNo">Of type int: Pin No of the user</param>
        [OperationContract]
        void AddUser(string username, string password, string name, string surname, string email,
            string mobileNo, string residence, string street, string town, string country, int pinNo);

        /// <summary>
        /// Checks whether the username actually exists. 
        /// </summary>
        /// <param name="username">Of type String. used to see whether this particular username exists. </param>
        /// <returns>Returns true or false</returns>
        [OperationContract]
        bool DoesUserNameExist(string username);

        /// <summary>
        /// Checks whether the email actually exists. 
        /// </summary>
        /// <param name="email">Of type String. used to see whether this particular email exists. </param>
        /// <returns>Returns true or false</returns>
        [OperationContract]
        bool DoesEmailExist(string email);
        
        /// <summary>
        /// Checks whether the pinNo actually exists. 
        /// </summary>
        /// <param name="pinNo">Of type int. used to see whether this particular pinNo exists. </param>
        /// <returns>Returns true or false</returns>
        [OperationContract]
        bool DoesPinExist(int pinNo);

        /// <summary>
        /// Gets all the users.
        /// </summary>
        /// <returns>Returns Entity Users.</returns>
        [OperationContract]
        IQueryable<UsersView> GetUsernames();
    }
}
